<?php
  include('lock.php');
  //store into cart upon clicking add
  if($_SERVER["REQUEST_METHOD"] == "POST")
  {
    if(isset($_POST['addID']))
    { 
      $add = addslashes($_POST['addID']);
      $sql=("INSERT INTO cart (demo_ID, user_ID) VALUES ('$add','$login_session')");
      mysql_query($sql);
	  
		$query = mysql_query("SELECT * FROM cart WHERE user_ID=$login_session");
		
		while($row=mysql_fetch_array($query, MYSQL_ASSOC)) {		
			$game = mysql_query("SELECT * FROM demo WHERE demo_ID=" . $row['demo_ID']);
			$result = mysql_fetch_assoc($game);
			echo $result['demo_name'];
			echo "<br />";
		}
	  
    }
  }
?>